import java.io.*;

public class JpgTest {
    public static void main(String[] args) throws IOException {

        File file = new File("C:\\Users\\14863\\Desktop\\lost");
        File[] files = file.listFiles();

        for (File file1 : files) {
            String fileName= file1.getName()+".JPG";
            System.out.println(fileName);
            FileInputStream fis = new FileInputStream(new File("C:\\Users\\14863\\Desktop\\lost\\"+file1.getName()));
            FileOutputStream fos = new FileOutputStream(new File("C:\\Users\\14863\\Desktop\\photo\\"+fileName));
            int read = 0;
            byte[] bytes = new byte[1024];
            while ((read = fis.read(bytes))!=-1){
                fos.write(bytes,0,read);
            }
            fos.close();
            fis.close();

            }

    }
}
